package com.hmsm.sys.controller;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;

import com.hmsm.sys.bean.LocalUser;
import com.hmsm.sys.service.RoleInfoService;
import com.lzyyj.gmis.base.model.Purview;

@Controller
public class PurviewController {
	
	@Resource
	private RoleInfoService roleInfoService;

	public RoleInfoService getRoleInfoService() {
		return roleInfoService;
	}

	public Map<String, Object> save(Purview item, LocalUser currentUser) {
		Map<String, Object> mapResult = new HashMap<String, Object>();
		
		try {
			item = getRoleInfoService().purviewSave(item, currentUser);
			mapResult.put("success", true);
		} catch (Exception e) {
			e.printStackTrace();
			mapResult.put("success", false);
			mapResult.put("errorMessage", e.getMessage());
		}
		
		return mapResult;
	}

	public Map<String, Object> del(Purview item, LocalUser currentUser) {
		Map<String, Object> mapResult = new HashMap<String, Object>();
		
		try {
			getRoleInfoService().purviewDel(item.getId(), currentUser);
			mapResult.put("success", true);
		} catch (Exception e) {
			e.printStackTrace();
			mapResult.put("success", false);
			mapResult.put("errorMessage", e.getMessage());
		}
		
		return mapResult;
	}

}
